package com.demo.controller.manage;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import com.demo.dao.Result;
import com.demo.pojo.manage.ProcessRecord;
import com.demo.service.manage.ProcessRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/manage/processRecord")
public class ProcessRecordController {

    @Autowired
    private ProcessRecordService processRecordService;

    @GetMapping
    public Result<Page<ProcessRecord>> getProcessRecord(int pageNum, int pageSize,
                                                        @RequestParam(required = false,defaultValue = "") String description,
                                                        @RequestParam(required = false,defaultValue = "") String status) {
        Page<ProcessRecord> page = processRecordService.lambdaQuery()
                .like(ProcessRecord::getDescription, description)
                .like(ProcessRecord::getStatus, status)
                .page(Page.of(pageNum, pageSize));
        return Result.success(page);
    }
}
